let n = 0
let over = false
let t1 = setInterval(function () {
    n++
    let nprogress = document.querySelector('.nprogress')
    if (n >= 95 && !over) return
    if (nprogress) {
        nprogress.style.width = n + '%'
    } else {
        let nprogress = document.createElement('div')
        nprogress.className = 'nprogress'
        nprogress.style.position = 'fixed'
        nprogress.style.top = 0
        nprogress.style.height = '5px'
        nprogress.style.width = n + '%'
        nprogress.style.backgroundColor = '#29d'
        document.body.appendChild(nprogress)
        var nprogressRadius = document.createElement('div')
        nprogressRadius.className = 'nprogressRadius'
        document.body.appendChild(nprogressRadius)    
    }
    if (n >= 100) {
        clearInterval(t1)
        document.body.removeChild(nprogress)
        document.body.removeChild(document.querySelector('.nprogressRadius'))
    }
}, 10)
window.onload = function () {
    over = true
}